<?php 
namespace App\HttpController\Index;

use EasySwoole\Task\AbstractInterface\TaskInterface;
use EasySwoole\EasySwoole\Task\TaskManager;

class Task implements TaskInterface
{
	
	public $param;
	
	function __construct($param){
		$this->param = $param;
	}
	
    function run(int $taskId, int $workerIndex)
    {
    	sleep(1);
    	
    	var_dump($this->param);
    	
        var_dump('ccccccc');
        
        TaskManager::getInstance()->async(function (){
           var_dump('rrrrrr');
        });
        
    }

    function onException(\Throwable $throwable, int $taskId, int $workerIndex)
    {
        var_dump( $throwable->getMessage() );
    }
}

